package com.hrpmar.controller;

import com.hrpmar.pojo.Provider;
import com.hrpmar.service.ProviderService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by dell on 2017/11/19.
 */
@Controller
@RequestMapping("/provider")
public class ProviderController {

    @Resource
    private ProviderService providerService;

    @GetMapping("/display")
    public String getProviderById(Integer proId, Model model){
        Provider provider = providerService.getProviderById(proId);
        model.addAttribute("p",provider);
        return "pro/display";
    }

    @RequestMapping("/report")
    public ModelAndView report(String fmt) {
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("format", fmt);
        //model.put("roleId", roleId);
        return new ModelAndView("ProReport", model);
    }

}
